package com.wf.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wf.dao.dos.Archives;
import com.wf.dao.pojo.Article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {

    /**
     * 插入文章记录并返回自增主键
     * @param article 文章实体对象
     * @return 插入成功的记录数
     */
    @Insert("INSERT INTO ms_article (title, summary, comment_Counts, view_Counts, author_Id, body_Id, category_Id, weight, create_Date) " +
            "VALUES (#{title}, #{summary}, #{commentCounts}, #{viewCounts}, #{authorId}, #{bodyId}, #{categoryId}, #{weight}, #{createDate})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertArticle(Article article);

}
